#ifndef _YEP_VIDEO_SCREEN_HPP
#define _YEP_VIDEO_SCREEN_HPP

#include "../common.hpp"
#include "Canvas.hpp"
namespace yep
{

/**
 * @brief Represents the Window canvas. @b [singleton].
 *
 * It is a currently a @b singleton class, as SDL implements multiple window and/or multiple monitors
 *  we'll modify this. For now, we haven't choices. The method to access the object is the instance().
 **/
class Screen: public Canvas
{
public:
	/**
	 * @brief Just a destructor. Don't annoy yourself thinking too much about this :)
	 */
	~Screen();

	/**
	 * @brief Sets the video mode.
	 * @param width the width;
	 * @param height the height;
	 * @param bpp The number of bits per pixel. Typically it is one of these:
	 *   - @b 8: Limited and hard to use, but its pallete can provide beautiful effects.
	 *   - @b 15/16: The old High Color Depth. No more much used, but can be useful on devices having low memory.
	 *   - @b 24: The true color. But the tree bytes structure is hostile for most architectures. So it is slow.
	 *   - @b 32: The true color with alpha. Combine fastness and best Color Depth (True Color!). It is most used actually.
	 * @param flags The SDL screen flags. We tested only SDL_HWSURFACE, SDL_SWSURFACE
	 *    and SDL_FULLSCREEN, but other flags should work as well.
	 */
	void setVideoMode(int width, int height, int bpp, int flags);

	/**
	 * @brief Sets Fullscreen.
	 *
	 * The old SDL_SetFullscreen do not work always so it uses setVideoMode internally to ensure it will change.
	 */
	void setFullScreen(bool full);

	/**
	 * @brief Return if it is fullscreen.
	 */
	bool isFullScreen() const;

	/**
	 * @brief Returns the window caption.
	 *
	 * It can't be called before the setVideoMode()
	 *
	 **/
	string getCaption() const;

	/**
	 * @brief Changes the window caption.
	 *
	 * It can't be called before the setVideoMode()
	 *
	 **/
	void setCaption(const string &value);

	/**
	 * @flips screen.
	 *
	 * It is this method that updates the user screen and show to the player the changes made.
	 */
	void flip();

	/**
	 * @brief Return the screen
	 */
	static Screen &getInstance();

	/**
	 * @brief Return true if the setVideoMode was called at least once.
	 */
	bool initialized() const;

	/**
	 * @brief Return true if the setVideoMode was called at least once.
	 */
	operator bool() const
	{
		return initialized();
	}

private:
	Screen();

	static Screen *instance;
};

}

#endif // _YEP_VIDEO_SCREEN_HPP
